package gamegui;
import gamegui.MainGame;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class ViewGameScreen extends JPanel {

	/**
	 * Create the panel.
	 */
	JButton backToMainButton;
	final Dimension dim = new Dimension (1100, 730);
	final Dimension but = new Dimension (140, 60);
	private GamePlayPanel playPanel;
	Font scoreFont = new Font("Helvetica", Font.BOLD, 48);
	Font timeFont = new Font("Helvetica", Font.BOLD, 60);
	public ViewGameScreen() {
		// Variables
        Dimension scoreSize = new Dimension(100, 100);
        Dimension timeSize = new Dimension(180, 80);
        Dimension playPanelSize = new Dimension(400, 600);
        
        Dimension exitSize = new Dimension(70, 70);
        Point redLoc = new Point(640, 180);
        Point blueLoc = new Point((int) redLoc.getX(), 370);
        Point timeLoc = new Point(620, 500);
        Point playPanelLoc = new Point(103, 40);
        Point exitLoc = new Point(1014, 621);
        

        
       
        //playPanel.setBackground(Color.red);
        
        JLabel label = new JLabel();
        ImageIcon gameImage = new ImageIcon("play-game-step2.jpg");    
        label = new JLabel("", gameImage, JLabel.CENTER);
        label.setLocation(0, 0);
        label.setPreferredSize(dim);
        
        // PLAY PANEL
        playPanel = new GamePlayPanel();
        playPanel.setLocation(playPanelLoc);
        playPanel.setSize(playPanelSize);
        label.add(playPanel);
        // Score Texts
        // Reds score
        JTextField scoreRed = new JTextField("0");
        scoreRed.setLocation(redLoc);
        scoreRed.setSize(scoreSize);
        scoreRed.setForeground(Color.red);
        scoreRed.setOpaque(false);
        scoreRed.setEditable(false);
        scoreRed.setBorder(null);
        scoreRed.setFont(scoreFont);
        label.add(scoreRed);
        
        // Blues score
        JTextField scoreBlue = new JTextField("0");
        scoreBlue.setLocation(blueLoc);
        scoreBlue.setSize(scoreSize);
        scoreBlue.setForeground(Color.red);
        scoreBlue.setOpaque(false);
        scoreBlue.setEditable(false);
        scoreBlue.setBorder(null);
        scoreBlue.setFont(scoreFont);
        label.add(scoreBlue);
        
        // Time
        JTextField timeText = new JTextField("0:0", SwingConstants.CENTER);
        timeText.setLocation(timeLoc);
        timeText.setSize(timeSize);
        timeText.setForeground(Color.red);
        timeText.setBorder(null);
        timeText.setEditable(false);
        timeText.setOpaque(false);
        timeText.setFont(timeFont);
        label.add(timeText);
        
     
        
        //add game play planel(map) to the game screen
//        playPanel = new GamePlayPanel();
//        add(playPanel);
//        label.add(gamePlayPanel);
        
        // Exit Button
        backToMainButton = new JButton("Back");
        backToMainButton.setSize(exitSize);
        backToMainButton.setLocation(exitLoc);
        backToMainButton.setForeground(Color.red);
        backToMainButton.setActionCommand("ExitToMain");
        ImageIcon exitImg = new ImageIcon("biktim.jpg");    // exit image
        JLabel exitLabel = new JLabel("", exitImg, JLabel.CENTER);
        backToMainButton.add(exitLabel);
        label.add(backToMainButton);
        
        add(label);
	}
	public JButton getBackToMainButton(){
		return backToMainButton;
	}
	public JPanel getPlayPanel(){
		return playPanel;
	}
       
	
}
